<template>
  <div id="name">
    <div class="wl-body">
      <div class="bzzxbg mtp-10" v-for="(itype, index) in type" :key="index">
        <div class="help-t">
          {{ dqyy == "en-US" ? itype.titleEn : itype.title }}
        </div>
        <van-list
          v-model="loading"
          :finished="finished"
          @load="onLoad(itype.id)"
        >
          <div
            @click="goto('bzzxxx', item)"
            v-for="(item, k) in lslist"
            :key="k"
          >
            <div class="help-s slideIn" v-if="item.hid == itype.id">
              <span> {{ dqyy == "en-US" ? item.titleEn : item.title }}</span>
               <div class="bz-r"><img src="../assets/timg/r.png" alt="" /></div>
            </div>
          </div>
        </van-list>
        <div v-if="!type">
          <img src="../assets/timg/nodata.png" alt="" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "name",
  data() {
    return {
      isPublish: false,
      lslist: [],
      loading: false,
      finished: false,
      pageNum: 1,
      type: [],
      dqyy: this.$store.getters.language || "zh-CN",
    };
  },
  created() {
    this.gettype();
  },
  methods: {
    guanbi() {
      this.$router.go(-1);
    },

    goto(val, data) {
      this.$router.push({ path: val });
      sessionStorage.setItem("hpdata", JSON.stringify(data));
    },
    gettype() {
      var datas = {
        pageSize: 100000,
        pageNum: 1,
      };

      this.$get({
        url: "mms-help/getTypeList",
        data: datas,
        callback: (data) => {
          this.$nextTick(function () {
            var list = data.data;
            if (list) {
              this.type = list;
            }
          });
        },
      });
    },

    onLoad(val) {
      var datas = {
        hid: val,
        pageSize: 10,
        pageNum: this.pageNum,
      };
      this.$get({
        url: "mms-help/getContentList",
        data: datas,
        callback: (data) => {
          this.$nextTick(function () {
            var list = data.data;
            if (list) {
              this.show = true;
              if (this.pageNum > 1) {
                this.lslist = [...this.lslist, ...list];
              } else {
                this.lslist = list;
              }
              this.loading = false;
              if (list.length != 0) {
                this.pageNum++;
              } else {
                this.finished = true;
              }
            }
          });
        },
      }).catch(() => {
        this.$toast(this.$i18n.t("m.errordata"));
      });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>